const express = require('express');
const router = express.Router();
router.get('/forClaim', (req, res) => {
    const content = [];
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            code: `SP-2019-${i}`,
            subDealerCode: `EJJXS-${i}`,
            branchCode: 'QR',
            causePartCode: `PJ-${i}`,
            vin: `VIN-2019-${i}`,
            faultDescription: `faultDescription-2019-${i}`,
            approverName: 'test',
            approveTime: '2019-09-12T11:27:39.715Z'
        });
    res.json({
        message: '',
        payload: {
            content,
        }
    });
});
router.get('/forCurrentUser', (req, res) => {
    const content = [];
    const {pageIndex, pageSize} = req.query;
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            code: `WXSP-2019-${i}`,
            dealerCode: `JXS-${i}`,
            dealerName: `经销商-${i}`,
            country: '中国',
            brandCode: 'QR',
            causePartCode: `PJ-${i}`,
            causePartName: `旧件-${i}`,
            vin: `VIN-2019-${i}`,
            productCategoryCode: `CX-2019-${i}`,
            status: 1,
            settlementStatus: 1,
            usedPartStatus: 1,
            repairType: 1,
            totalFee: 998,
            isCountersign: true,
            countersigner: '会签人',
            createTime: '2019-09-12T11:27:39.715Z',
            submitTime: '2019-09-12T11:27:39.715Z',
            approveTime: '2019-09-12T11:27:39.715Z',
            rowVersion: 'string',
            options: ['submit', 'update', 'abandon', 'approve', 'add', 'return', 'countersigner']
        });
    res.json({
        message: '',
        payload: {
            content,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/history', (req, res) => {
    const content = [];
    const {pageIndex, pageSize} = req.query;
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            code: `WXSP-2019-${i}`,
            dealerCode: `JXS-${i}`,
            dealerName: `经销商-${i}`,
            brandCode: 'QR',
            causePartCode: `PJ-${i}`,
            causePartName: `旧件-${i}`,
            vin: `VIN-2019-${i}`,
            productCategoryCode: `CX-2019-${i}`,
            status: 1,
            settlementStatus: 1,
            usedPartStatus: 1,
            repairType: 1,
            totalFee: 998,
            createTime: '2019-09-12T11:27:39.715Z',
            submitTime: '2019-09-12T11:27:39.715Z',
            approveTime: '2019-09-12T11:27:39.715Z',
            rowVersion: 'string',
            options: ['submit', 'update', 'abandon', 'approve', 'add', 'return']
        });
    res.json({
        message: '',
        payload: {
            content,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增'
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: '编辑'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交'
    });
});
router.put('/:id/pass', (req, res) => {
    res.json({
        message: '审核通过'
    });
});
router.put('/:id/reject', (req, res) => {
    res.json({
        message: '驳回'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废'
    });
});
router.get('/export/forCurrentUser', (req, res) => {
    res.json({
        message: '导出'
    });
});
router.put('/:id/countersignerPass', (req, res) => {
    res.json({
        message: '会签通过'
    });
});
router.put('/:id/countersignerRefuse', (req, res) => {
    res.json({
        message: '拒绝会签'
    });
});
router.put('/:id/countersigner', (req, res) => {
    res.json({
        message: '发起会签/下一级会签'
    });
});
router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            code: 'WXSP2019082700-1',
            subDealerId: '1',
            subDealerCode: '10145-1',
            subDealerName: '二级服务站名称10145-1',
            subClaimApplyId: '1',
            subClaimApplyCode: 'EJ0001',
            brandId: '1',
            brandCode: 'QR',
            brandName: '奇瑞',
            currency: 1,
            repairType: 1,
            faultModeId: '1',
            faultModeCode: 'GZMS01',
            faultModeName: '故障模式',
            faultDescription: 'string',
            isOut: true,
            outFee: 200,
            supplierId: '1',
            supplierCode: '10086',
            supplierName: '中国移动',
            dutyUnitId: '2',
            dutyUnitCode: '10010',
            dutyUnitName: '中国联通',
            partPurchasedDate: '2019-09-04T02:37:44.918Z',
            vehicleSoldId: '1',
            vin: 'vin-2019-09-15',
            mileage: 150000,
            engineCode: 'LV2019-09-10-001',
            saleDate: '2019-09-04T02:37:44.918Z',
            shippingDate: '2019-09-04T02:37:44.918Z',
            customerName: '嘻嘻哈哈',
            cellPhoneNumber: '18963214785',
            repairCode: 'WX20190919001',
            repairDate: '2019-09-04T02:37:44.918Z',
            rowVersion: 'string',
            country: '中国',
            createTime: '2019-09-04T02:37:44.918Z',
            transmissionSn: 'BSX-2019-10-31',
            productCategoryCode: 'CX-2019-10-31',
            productCategoryName: '型号0001',
            annoucementNumber: 'GGH-2019-10-31',
            operationsNature: 1,
            isKD: true,
            claimMaterialDetails: [
                {
                    isCaused: true,
                    usedPartId: '1',
                    usedPartCode: 'JJ0001',
                    usedPartName: '旧件0001',
                    usedPartBarCode: 'JJ0001',
                    newPartId: '1',
                    newPartCode: '新件0001',
                    newPartName: 'XJ0001',
                    usedPartDealCategory: 1,
                    unit: '件',
                    quantity: 1,
                    price: 520,
                    materialFee: 520,
                    mgmtRate: 0.8,
                    mgmtFee: 568
                }, {
                    isCaused: false,
                    usedPartId: '2',
                    usedPartCode: 'JJ0002',
                    usedPartName: '旧件0002',
                    usedPartBarCode: 'JJ0002',
                    newPartId: '2',
                    newPartCode: '新件0002',
                    newPartName: 'XJ0002',
                    usedPartDealCategory: 1,
                    unit: '件',
                    quantity: 1,
                    price: 520,
                    materialFee: 520,
                    mgmtRate: 0.8,
                    mgmtFee: 568
                }
            ],
            claimWorkItemDetails: [
                {
                    usedPartId: '1',
                    usedPartCode: '配件01',
                    workItemId: '1',
                    workItemCode: 'XM0001',
                    workItemName: '维修项目0001',
                    laborHour: 5,
                    laborPrice: 200,
                    laborFee: 1000,
                    remark: 'string',
                    
                }, {
                    usedPartId: '2',
                    usedPartCode: '配件02',
                    workItemId: '2',
                    workItemCode: 'XM0002',
                    workItemName: '维修项目0002',
                    laborHour: 5,
                    laborPrice: 200,
                    laborFee: 1000,
                    remark: 'string',
                }
            ],
            claimAthDetails: [
                {
                    type: 1,
                    attachments: [
                        {
                            fileId: '1',
                            fileName: '附件01'
                        }, {
                            fileId: '2',
                            fileName: '附件02'
                        }
                    ]
                },
                {
                    type: 2,
                    attachments: [
                        {
                            fileId: '3',
                            fileName: '附件01'
                        }, {
                            fileId: '4',
                            fileName: '附件02'
                        }
                    ]
                }
            ],
            details: [
                {
                    usedPartId: '5',
                    usedPartCode: 'JJ0005',
                    usedPartName: '旧件0005',
                    usedPartBarCode: 'JJ0005',
                    usedPartDealCategory: 1,
                    unit: '件',
                    quantity: 1,
                    price: 520,
                    materialFee: 520
                }
            ],
            claimResultDetails: [
                {
                    id: '1',
                    approverName: '测试',
                    approveComment: 'string1',
                    approvedResult: 'string1',
                    approveTime: '2019-09-04T02:37:44.918Z',
                }, {
                    id: '2',
                    approverName: '测试',
                    approveComment: 'string2',
                    approvedResult: 'string2',
                    approveTime: '2019-09-04T02:37:44.918Z',
                }
            ]
        }
    });
});
module.exports = router;
